package sensorLAN;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Procesos {

	public static void main(String[] args) {
		String servicios= "sc query type= service state= all";
		String tareas= "tasklist";
		Process p, p1;
		try {
			p = Runtime.getRuntime().exec(servicios);
			p1= Runtime.getRuntime().exec(tareas);
			
			mostrar(p);
			System.out.println("------------------------------------------------------------------------------");
			mostrar(p1);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	private static void mostrar(Process p) throws IOException{
		BufferedReader reader = new BufferedReader
				(new InputStreamReader(p.getInputStream()));
		String line;
		while ((line = reader.readLine()) != null) {
			System.out.println(line);
		}
	}
}
